<?php

Yii::import('application.models._base.BaseCollege');

class College extends BaseCollege {

    public static function model($className = __CLASS__) {
        return parent::model($className);
    }
    public $confirm_email;

    public function rules() {
        return array(
                        array('designation, hod_first_name, hod_last_name, hod_email, hod_mobile_number ', 'required','on' => 'insert'),
            array('college_name, designation,college_address, hod_first_name, hod_last_name, hod_email, hod_phone_number_office, hod_mobile_number, hod_fax_number, administrative_phone_number, administrative_fax_number, administrative_email, student_total, state_id, university_id, authority_id', 'required','on' => 'update'),
            array('student_total, state_id, university_id, authority_id', 'numerical', 'integerOnly' => true),
            array('college_name', 'length', 'max' => 55),
             array('confirm_email', 'compare', 'compareAttribute'=>'hod_email'),
            array('college_name', 'unique', 'on' => 'checkout', 'message' => Yii::t('validation', 'Collge name has already been taken.')),
            array('hod_email,administrative_email', 'email'),
            array('college_name', 'unique'),
            array('college_address, college_address1, hod_email, administrative_email', 'length', 'max' => 45),
            array('hod_title, hod_phone_number_office, hod_phone_number_residence, hod_fax_number, administrative_phone_number, administrative_fax_number', 'length', 'max' => 15),
            array('hod_first_name, hod_last_name', 'length', 'max' => 50),
            array('hod_mobile_number', 'length', 'min'=>10,'max' => 10),
            array('id, college_name, college_address, college_address1, hod_title, hod_first_name, hod_last_name, hod_email, hod_phone_number_office, hod_phone_number_residence, hod_mobile_number, hod_fax_number, administrative_phone_number, administrative_fax_number, administrative_email, student_total, state_id, university_id, authority_id', 'safe', 'on' => 'search'),
        );
    }

    public function attributeLabels() {
        return array(
            'id' => Yii::t('app', 'ID'),
            'college_name' => Yii::t('app', 'Name'),
            'college_address' => Yii::t('app', 'Address'),
            'college_address1' => Yii::t('app', 'Address1'),
            'hod_title' => Yii::t('app', 'Title'),
            'hod_first_name' => Yii::t('app', 'First Name'),
            'hod_last_name' => Yii::t('app', 'Last Name'),
            'hod_email' => Yii::t('app', 'Email'),
            'hod_phone_number_office' => Yii::t('app', 'Phone Number Office'),
            'hod_phone_number_residence' => Yii::t('app', 'Phone Number Residence'),
            'hod_mobile_number' => Yii::t('app', 'Mobile Number'),
            'hod_fax_number' => Yii::t('app', 'Fax Number'),
            'administrative_phone_number' => Yii::t('app', 'Phone Number'),
            'administrative_fax_number' => Yii::t('app', 'Fax Number'),
            'administrative_email' => Yii::t('app', 'Email'),
            'student_total' => Yii::t('app', 'Total No Of Students'),
            'state_id' => Yii::t('app', 'State Name'),
            'university_id' => Yii::t('app', 'Affilating University'),
            'authority_id' => Yii::t('app', 'Regulatory Authority'),
        );
    }

}
